473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

In IE ok - but not in Opera and Firefox

pzi
Is anything significant not ok with my code?
It works in IE but not with any other browser. What did I wrong - I
dont see the point.

Thanks for any hints.
<script language='javascript'>

<!--
function CalcPrices(inPrice)
{
return (inPrice * 1.0 );
}

function PicID(inPrev,inNext)
{
location.href (inPrev + 1633 + "&fID=1086" + inNext);
}
//-->
</script>

<a
href='javascript:PicID("Shop.asp?act=add&pID=","&p rID=1004&pdetID=1301");'>
<script>document.write(Math.round(CalcPrices(155)) )</script>
</a>

May 29 '06 #1
3 1360
VK
pzi wrote:
Is anything significant not ok with my code?
It works in IE but not with any other browser. What did I wrong - I
dont see the point. location.href (inPrev + 1633 + "&fID=1086" + inNext);


That was just recently dicussed in this group. If you open JavaScript
Console in Firefox (Tools>JavaScript Console) it will tell you the
exact reason: "location.href is not a function". And it's very true
because location.href is a /property/ you assign like location.href =
foo;

As the amount of users refusing to read any manuals out of principles
is traditionally very (confirmed by this post :-) Microsoft in
violation of specs and against of their own MSDN documentation allows
to use location.href as a function call. It is a hack made for lazy
users by one careless producer so no other UA allows it.

May 29 '06 #2
pzi wrote:
Is anything significant not ok with my code?
It works in IE but not with any other browser. What did I wrong - I
dont see the point.

Thanks for any hints.

Hi pzi,

Some hints:

<script language='javascript'>
Do not use that. It is depricated for years now.
Use:
<script type="text/javascript">
instead.

</script> is still the same.

<!--
I don't think you'll need to keep the <!-- up in your code these days.
All used browsers on the net handle javascript tags allright.
function CalcPrices(inPrice)
{
return (inPrice * 1.0 );
}
Not a very usefull function, but I guess this is just an example.

function PicID(inPrev,inNext)
{
location.href (inPrev + 1633 + "&fID=1086" + inNext);
}
try something like this instead

function PicID(inPrev,inNext)
{
var myLoc = "http://www.yoursite.com/" + inPrev + 1633 + "&fID=1086" +
inNext;
alert (myLoc);
// The alert is just for yourself to test of course.

location.href (inPrev + 1633 + "&fID=1086" + inNext);

That is strange Javascript, maybe wrong.
Try
location = myLoc;
}

//-->
</script>

<a
href='javascript:PicID("Shop.asp?act=add&pID=","&p rID=1004&pdetID=1301");'> <script>document.write(Math.round(CalcPrices(155)) )</script>
</a>

This is not advised. Do not use javascript in an URL.
Javascript is not a real protocol (like http or ftp).

It is often better to make a span with an onClick-handler, like this:
<span onClick="PicID(etc.etc);">Click me</span>

I think if you fix the suggested problems you'll be fine.
Regards,
Erwin Moller
May 29 '06 #3
Erwin Moller wrote:
pzi wrote:
<!--


I don't think you'll need to keep the <!-- up in your code these days.
All used browsers on the net handle javascript tags allright.


It was and is potentially harmful. Search the archives.
PointedEars
--
Let us not judge others because of their religion, color or nationality.
We are all just human beings living together on this planet. (poehoe.de)
May 29 '06 #4

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

Similar topics

3
by: Boris | last post by:
Please open http://www.highscore.de/opera/floatleft.html in Opera 7.54 and Firefox 1.0 Preview. Who is right? In my humble opinion Opera 7.54 is right: According to CSS 2.1 a "floating box must...
36
by: Unknown User | last post by:
Opera 8 has just been released earlier this week and has had an amazing return with over 600,000 downloads the first day. Opera Internet Suite's CEO says he will swim from Norway to the USA if in...
11
by: Hymer | last post by:
Hello, I have a small table that works fine in IE6 but does not render at all in Opera or Firefox. Can anyone see what might be needed to get this to work in all three browsers? The code...
2
by: André Wagner | last post by:
I'm trying to get all the "divs" that have a given NAME using getElementsByName(). For example, the following code: <html> <head> <script type="text/javascript"> function on_load() { var...
2
by: Mark Rae | last post by:
Hi, I've just finished upgrading a site for a client to XHTML-compliance. It's been tested on the latest versions of the following OS / browser combinations: WinXP - IE WinXP - Netscape...
2
by: Hymer | last post by:
Hello, I have a footer at the end of each article in my blog at http://www.usernomics.com/news/user-interface-design-news.html . The footer looks perfect in IE but has smaller text in Firefox...
7
by: Dr J R Stockton | last post by:
I've heard that at <URL:http://www.merlyn.demon.co.uk/js-clndr.htm#P> and using Opera the suffixed dates in the yellow box appear in a single long line instead of in the obvious weekly manner. ...
6
by: raknin | last post by:
I am creating a dynamic list on the server using php file,when I run the PHP script in all 4 browsers (IE 6, Firefox 2, opera and safari 3) every think go Ok and the list is created. but when I call...
2
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, I have a gridview and I need it to display correctly in Opera. I need to set the row height, so that even on the last page of data all the rows are the same height as on the other pages. ...
15
by: dhtml | last post by:
Title says it. If I use a for in loop on an HTML collection, I get length twice. <!DOCTYPE HTML> <html lang="en"> <head> <title>length twice</title> </head> <body> <form...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.