![]() |
document object works in IE but not in FF
Hi Guys,
The following snippet works perfectly in IE. I can't get code below to work in FF. The code returns file path and path when saved and opened as html file. Thanks for your help. <html> <body> cmCreatePageviewTag("<<label id="myDiv1"></label>>","<<label id="myDiv2"></label>>"); <script type="text/javascript"> var myDiv1 = document.getElementById("myDiv1"); var myDiv2 = document.getElementById("myDiv2"); myDiv1.innerText = window.location.pathname; var path = top.location.pathname; if (document.all) { path = path.replace(/\\/g,"/"); } path = path.substr(0,path.lastIndexOf("/")); var full_path = path; myDiv2.innerText = full_path; </script> </body> </html> |
I would try with
Code:
myDiv1.innerHTML = window.location.pathname; |
Thanks xelawho for your reply. I had that exact experssion previously, didn't make a difference. You'll see if you save as html file then open in url window. Still trying to solve but any help is welcome.
|
:confused:
using innerHTML I get the same output in IE, FF and Chrome... |
Yeah you right works on my home pc, strange I think I tried on my work computer and it didn't work. Thanks for your help. I will confirm and reply when I go to work Monday.
|
Guys,
Is there a way to get the value of the output html to show within the same page view source, without hardcoding it inside the javascript? I need to be able to produce this value in multiple individual pages. Thank for any help or suggestions. |
Basically I want to be able to show result of output html in view source, below as an eg:
cmCreatePageviewTag("</C:/Users/Test/Documents/test.html>","</C:/Users/Test/Documents/>"); |
Guys I get the below code to work in IE, but not in FF. Any ideas getting it to work in FF?
Code:
<html> |
no, because it uses activex objects which are exclusive to IE
|
Thanks Guys for your response. How do I replace \ with : in code below. Try it in code below but it's not working.
Code:
cmCreatePageviewTag("<<label id="myDiv1"></label>>","<<label id="myDiv2"></label>>"); |
Nevermind guys I got it working, here is the solution below plus uppercase function:
Code:
cmCreatePageviewTag("<<label id="myDiv1"></label>>","<<label id="myDiv2"></label>>"); |
| All times are GMT +1. The time now is 04:41 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.