![]() |
|
| eliminate file path from img src |
| eliminate file path from img src |
|
Moderator ![]()
|
how are you designing the editor?
maybe they do something like, if the img path has the same path as the path for the currently poened file, then only use the name of the file, else use the whole path. document.getElementById('imgname').src="" is JS for clearing its source attribute, but I doubt you want that. |
|||||||||||||||
|
|
||||||||||||||||
| eliminate file path from img src |
|
Junior Member(L1) ![]()
|
I'm designing the editor by using Microsoft's execCommands that work in IE 5+ for operations like bold, indent, align, insert image, etc. applied to an iframe that serves as a WYSIWYG editing window. Buttons execute the commands and the user types in/inserts content. Basically, I have to find a script that over-rides the default behavior of Microsoft's insert image dialog to use a file path in the img src tag. I'll try your script. |
|||||||||||||||
|
|
||||||||||||||||
| eliminate file path from img src |
|
Moderator ![]()
|
have you got it working?
if not, could you also explain what you're trying to do in more detail, maybe showing us some code. |
|||||||||||||||
|
|
||||||||||||||||
| eliminate file path from img src |
|
Junior Member(L1) ![]()
|
It's working except for glitches in inserting absolute file paths for images and relative links. I got the information on how to program the editor from a Microsoft's forum and a couple online tutorials about building your own WYSIWYG editor. The application is WAY too long to post here and I don't have it on a website yet. All I need to finish it is a script to eliminate absolute file paths from the HTML source code either when the image or link is inserted or when the page under construction is saved. I know this is possible because most WYSIWYG editors do it. Here are the functions involved in the absolute path problem: function doLink() { iView.document.execCommand('createlink'); } function insertImage() { iView.focus(); iView.document.execCommand('insertimage', true, null); } (The true setting calls the IE modal dialog which automatically uses file path in the image tag) function saveFrame() { var title = prompt("ENTER PAGE TITLE","My Page"); var html = iView.document.documentElement.outerHTML; var html_txt = "<html><head><title>" + title + "</title></head>\n"; html_txt += html + "\n</body></html>"; iView.document.write(html_txt); iView.document.execCommand('SaveAs',null,'index for homepage'); } |
|||||||||||||||
|
|
||||||||||||||||
| eliminate file path from img src |
|
||
|
|



