473,549 Members | 2,561 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE javascript:func tion() link error

Some windows IE users encounter an error when launching javascript
from my links. An error is generated before the window opens.
For example:

<a href="javascrip t:PlayCosmos('p r-08-highlights-eurosport','738 5866',
13,4,2008);">On e Minute Race Highlights from Paris-Roubaix</a>

function PlayCosmos(titl e, id, day, month, year) {
url = 'http://cosmos.bcst.yah oo.com/up/player/popup/index.php?
cl='+id;
NewWindow(url,t itle,430,426,'n o');
}

function NewWindow(mypag e, title, w, h, scroll) {
OpenWindow(mypa ge, title, w, h, scroll);
win.window.focu s();
}

function OpenWindow(mypa ge, title, w, h, scroll) {
var winl = parseInt((windo w.screen.width - w) / 2);
var wint = parseInt((windo w.screen.height - h) / 2);
winprops = 'height='+h+',w idth='+w+',top= '+wint+',left=' +winl
+',scrollbars=' +scroll+',resiz able=no';
win = window.open(myp age, title, winprops);
}
Anyone know why?

There are other variations of javascripts links that don't work in my
"Cycling video clip of the day" section on my home page:
http://www.steephill.tv

tia,
Steve
Jun 27 '08 #1
5 1371
On Apr 16, 7:21 am, steephill...@gm ail.com wrote:
Some windows IE users encounter an error when launching javascript
from my links. An error is generated before the window opens.
For example:

<a href="javascrip t:PlayCosmos('p r-08-highlights-eurosport','738 5866',
13,4,2008);">On e Minute Race Highlights from Paris-Roubaix</a>
It does not seem sensible to create a reliance on script support when
it isn't necessary.

function PlayCosmos(titl e, id, day, month, year) {
url = 'http://cosmos.bcst.yah oo.com/up/player/popup/index.php?
cl='+id;
NewWindow(url,t itle,430,426,'n o');
}
Consider instead (will break on wrapping):

<a href="http://cosmos.bcst.yah oo.com/up/player/popup/index.php?
cl=7385866"
onclick="return playCosmos(this , 'pr-08-highlights-eurosport',
'7385866',
13,4,2008);"

And the playCosmos function can be modified to suit, something like:

function playCosmos(link , title, id, day, month, year) {
NewWindow(link. href, title,430,426,' no');
return false;
}

Now if the user has scripting disabled or not available, or the script
fails to execute correctly, there's still a good chance they can view
the clip and you've reduced your support requirements.

A couple of comments:
1. Why use 3 functions where one would do?
2. It is usual to reserve functions names starting with capital
letters for constructors.
3. Don't try to position the pop-up, let it go where the user puts
it. Consider someone with a desktop spread over two screens, your pop-
up will be split between the two. Also, users with large or wide
screens probably don't want a small movie in the center of the screen.
--
Rob
Jun 27 '08 #2
>A couple of comments:

I'm using a javascript as an anchor because the page will become
invalid in three months and I'll either redirect the user to another
page or I'll provide a user-friendly message. In other words, I want
control the implementation.

I appreciate your detailed feedback, but you didn't address my
question. Why doesn't the script work? Anyone know why?


Jun 27 '08 #3
st**********@gm ail.com wrote:
>A couple of comments:

I'm using a javascript as an anchor because the page will become
invalid in three months and I'll either redirect the user to another
page or I'll provide a user-friendly message. In other words, I want
control the implementation.
http://www.w3.org/Provider/Style/URI
I appreciate your detailed feedback, but you didn't address my
question. Why doesn't the script work? Anyone know why?
Because it can't. The `javascript:' URI scheme exists to return an HTML
document string from a JavaScript expression. Neither does this need to be
supported nor are you returning a HTML document string from PlayCosmos().
PointedEars
Jun 27 '08 #4
On Apr 16, 5:24*pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
steephill...@gm ail.com wrote:
A couple of comments:
I'm using a javascript as an anchor because the page will become
invalid in three months and I'll either redirect the user to another
page or I'll provide a user-friendly message. In other words, I want
control the implementation.

http://www.w3.org/Provider/Style/URI
I appreciate your detailed feedback, but you didn't address my
question. Why doesn't the script work? Anyone know why?

Because it can't. *The `javascript:' URI scheme exists to return an HTML
document string from a JavaScript expression. *Neither does this need tobe
supported nor are you returning a HTML document string from PlayCosmos().

PointedEars
Thanks for your answer. So why does this example from a Javascript
reference site work:
http://www.web-source.net/javascript_popup_window2.htm

So should I return an empty string from PlayCosmos or should it be
launched by the onclick event handler of the anchor?

thanks,
Steve
Jun 27 '08 #5
st**********@gm ail.com wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
>steephill...@g mail.com wrote:
>>>A couple of comments:
I appreciate your detailed feedback, but you didn't address my
question. Why doesn't the script work? Anyone know why?
Because it can't. The `javascript:' URI scheme exists to return an HTML
document string from a JavaScript expression. Neither does this need to be
supported nor are you returning a HTML document string from PlayCosmos().
[...]

Thanks for your answer. So why does this example from a Javascript
reference site work:
http://www.web-source.net/javascript_popup_window2.htm
If any such example works, then that should be considered a happy coincidence.

This site does not deserve to be called a "Javascript reference site",
whatever your understanding of the word "Javascript ". It promotes invalid
markup, obsolete techniques, and content that does not degrade gracefully
(i.e. is in violation of Section 508 and other accessibility guidelines and
legislation), to say the least. And one can find that out by just looking
at the example that you referred to. Guess what abominations of failed
attempts at Web application development other parts of it might reveal ...
So should I return an empty string from PlayCosmos or should it be
launched by the onclick event handler of the anchor?
You should do what Rob already recommended.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1477
by: Katja | last post by:
Hi all, I have a very bizarre problem. I have a button on a PHP page which I want to call a Javascript function when it is pressed. This is the code I have: echo "<td><a href='$a_row' onClick=\"call_flash('$a_row','$a_row','')\">$a_row</a></td>\n"; This line doesn't give me an error but the actual javascript funtion
1
2562
by: Patrice | last post by:
Hi, I'm trying to use a javascript function passing a vb variable. I don't understand why it doesn't work. Can someone help me? Thanks in advance. Here is my javascript function used to show a text:
1
4257
by: Leila | last post by:
Hi folks, I have a fairly complex xml document which looks like this: <my:InsideView xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-08-02T14:22:59" xml:lang="en-us"> <my:Title>Title in here</my:Title> <my:StandFirst>Standfirst in here</my:StandFirst> <my:RelatedMaterial>...
5
2201
by: lordslayer | last post by:
Helo! I have a little problem. My whole page (index.html) is based on one big table and an iFrame. In this iFrame one of the pages is a picture-thumbnail page. I found a javascript to open thumbnailed pictures in a really nice new window (it's not really a window but an iFrame, that can be moved around). The problem i am facing is that...
2
9151
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display in the status bar 'Symantec Corporation' whenever anyone mouses over (onMouseOver) my image or link OR when one clicks while holding the left mouse...
5
25840
by: elsenraat_76 | last post by:
Hello! I was wondering if someone could help me out with a problem I'm having? I'm trying to input a javascript value into an anchor tag (from a function), but don't have an event to call the function...if that makes sense. Here's what I mean... I have a javascript array set up like so: <script language="javascript"...
1
3510
by: jeff_m | last post by:
Hello all, I'm having an issue with the following: I have an .aspx page with two html links that call distinct Javascript functions. I also have an iframe in the html of this .aspx page. The Javascript functions are supposed to redirect the iframe to a new page (different page for each link).
4
59899
by: verci | last post by:
Hi guys, I'm running asp.net 2.0. Does anyone know how to fire or call a javascript function from inside my (VB.aspx) code without assigning it to a control attribute? thank you
3
6450
by: ravitunk | last post by:
hi..i have a javascript function which uses window.open() function to open another window... as below... <script language ="JavaScript"> function openWin(url) { window.open(url,"composerwindow","toolbar=no,width=350,height=400,status=no,scrollbars=yes,resize=no,menubar=no"); } </script> my ASP.net application sends an email...
0
7527
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7459
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7726
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7967
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7485
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5377
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1953
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.