Jump to content

JavaScript


marlai

Recommended Posts

Dear All,Below are 3 web pages, main.htm contain 3 frames, it load hh.html on header frame and empty.html on leftFrame and rightFrame.All java script:alert(date) work OK, but got error in the 1st link {alert(d) target="rightFrame"} when Google link is clicked, please help. ============ main.htm<HTML><!-- When open this html in IE, all java script:alert(date) in hh.html is OK, once Google clicked, <a href="java script:alert(date)" target="rightFrame"> got error, please help to solve it, I know remove "target=rightFrame" can solve it, but I need this to load other web page on rightFrame. --> <HEAD> </HEAD> <FRAMESET ROWS="94,*" framespacing=1> <FRAME src="HH.html" name="header" noresize scrolling="NO"> <FRAMESET cols="200,*" onResize="if (navigator.family == 'nn4') window.location.reload()"> <FRAME src="empty.html" name="leftFrame"> <FRAME src="empty.html" name="rightFrame"> </FRAMESET> </FRAMESET></HTML> ====== hh.html When open this html in IE, all java script:alert(date) in hh.html is OK, once Google clicked, "java script:alert(date)" target="rightFrame" got error, please help to solve it, <BR>I know remove "target=rightFrame" can solve it, but I need this to load other web page on rightFrame.<BR> <a href="java script:var d = new Date(); alert(d)" target="rightFrame"> <b> "java script:alert(date)" target="rightFrame" </b> </a>      <a href="java script:var d = new Date(); alert(d)" name="leftFrame"> <b> "java script:alert(date)" name="leftFrame" </b> </a>      <a href="java script:var d = new Date(); alert(d)" > <b> "java script:alert(date)" </b> </a>      <a href="http://www.google.com.hk/" target=rightFrame> <b> Google target=rightFrame </b> </a> ===== empty.html empty.html (no content, file size = 0)

Link to comment
Share on other sites

I don't understand what you want to achieve with the target attribute, and your meaning of "Google clicked". The alert will be pop up as a seperate window, and no page will be loaded :S

Link to comment
Share on other sites

First, try putting quotes around Google's TARGET value.If that doesn't work, I need some clarification... Is it before or after the Google link is clicked that you get an error when clicking the troublesome link?BTW, why are you targeting JS links to other windows? And what are you using name="leftFrame" for in the second link?EDIT: Woops, I'm a little late...

Link to comment
Share on other sites

I think that's a security feature of the browser. If you can execute JavaScript on a page in another site (like Google), you can spy on the user's interaction with that site.Can you accomplish your goal without executing JavaScript in Google? EDIT: I think you can change the URL of rightFrame, can't you?

<a href="http://hk.yahoo.com/" target="rightFrame">Yahoo! target=rightFrame</a>

Link to comment
Share on other sites

I think that's a security feature of the browser. If you can execute JavaScript on a page in another site (like Google), you can spy on the user's interaction with that site.Can you accomplish your goal without executing JavaScript in Google? EDIT: I think you can change the URL of rightFrame, can't you?
<a href="http://hk.yahoo.com/" target="rightFrame">Yahoo! target=rightFrame</a>

As the left frame will be a tree list, I need JS to expand the tree to get more selection for user, and also perform other JS function in main.htm.
Link to comment
Share on other sites

You can use JS to change the URL of the middle frame, but while it's at a different site you cannot (generally) execute JS within it. However, once you change the URL back to your site, the browser will allow you to use JS within it again.Just what are you wanting to do within that frame? EDIT: BTW, Ingolme gave a good solution for executing JS and changing the URL with the same link.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...