views:

69

answers:

2

javascript:

  1. location.href("somefile.php"); // successfully working with IE
  2. location.href = "somefile.php";

Ques 1. first code is not work with Safari. Why?
Ques 2. What is the difference b/w these codes.

Thanks,

+1  A: 

i never heard of location.href("somefile.php");... location.href = "somefile.php"; is the "normal" way that you should use.

oezi
+12  A: 
  1. href is not a method, it is a property whose value is a string.
  2. The first is a call on a method with a url as the argument (incorrect), the second is assigning the url as the value of the property (correct).

See also: http://www.w3.org/TR/Window/#location

Andy E