Hi,
In a script used by svg, I have a like like the following to go to a new web page:
parent.location.href = newUrl;
This works fine in IE6. However, it has no effect in ie7 (not even a error message, or security message) It just does nothing. (I tried window.location=, window.assign(newUrl), parent.location= .... none of it works, and I don't get an error message)
Where is there information on this? Could anybody advice me anything? Any workaround?
Thanks MR
2 3380
I would like to add my code , maybe somebody could be so nice and advice me anything.
I would like to add that the value of 'window.top.location.href is not getting
overwritten with the value newHref.
Does anybody think that I am doing two the same things that are ind the conflict?
Thanks in advance -
<?xml version="1.0" encoding="iso-8859-1"?>
-
<!-- Following is the DTD emitted by various Adobe products. -->
-
<!-- !DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"
-
"http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/
-
svg-20000303-stylable.dtd" -->
-
<svg id="svg" zoomAndPan="disable" width="700">
-
-
<style type="text/css">
-
<![CDATA[
-
/* In XML you must use a CDATA tag to delimit style content. */
-
-
.box {
-
stroke : black;
-
stroke-width : 2;
-
}
-
-
.border {
-
fill : lightgreen;
-
visibility : hidden;
-
}
-
-
text {
-
pointer-events : none;
-
}
-
-
line {
-
stroke : black;
-
stroke-width : 2;
-
}
-
]]>
-
</style>
-
-
<script><![CDATA[
-
-
var minX;
-
var minY;
-
var maxX;
-
var maxY;
-
-
var RELATED_ENTITY_X = 380;
-
var RELATED_ENTITY_HEIGHT = 50;
-
var RELATED_ENTITY_GAP = 20;
-
var RELATED_ENTITY_WIDTH = 200;
-
var FONT_SIZE = 15;
-
var RELATED_ENTITY_SPACING = RELATED_ENTITY_HEIGHT + RELATED_ENTITY_GAP;
-
-
var CIRCLE_RADIUS = 5;
-
var CROWS_FOOT_OFFSET = 7;
-
-
//draw cardinality symbols this proportion from ends of lines
-
var OPTIONALITY_POINT = 0.10;
-
var MULTIPLICITY_POINT = 0.05;
-
-
var STROKE_WIDTH_COMPENSATION = 15;
-
-
function displayDescription(entityName){
-
var loc = decodeURI(location + "");
-
if (loc.substr(0, 8) == "file:///") {
-
loc = loc.substr(8);
-
loc = loc.substr(0, loc.lastIndexOf("/")+1);
-
loc = top.GetAbsolutePathName(loc + "EntityDescription.html");
-
if (!top.FileExists(loc)) alert("returning"); // rather than risk IE crashing in XP SP2
-
}
-
alert("loc::"+loc + "?" + entityName);
-
//alert("DDParent::" + "file:///" +loc + "?" + entityName);
-
//parent.chgUrl(loc + "?" + entityName);
-
//window.location.href = loc + "?" + entityName;
-
var newHref = "file:///" + loc;
-
alert("newHref::"+newHref);
-
// + "?" + entityName;
-
alert("location.href::"+location.href);
-
alert("parent.location.href::"+parent.location.href);
-
alert("parent.parent.location.href::"+parent.parent.location.href);
-
alert("There are " + parent.frames.length + "frames");
-
alert("Setting href(" + parent.location.href+") to "+newHref);
-
-
//href = loc;
-
//parent.location.replace(loc);
-
//alert("Parent href is now "+parent.location.href);
-
//window.location.href = loc + "?" + entityName;
-
//parent.parent.location.href = loc + "?" + entityName;
-
alert("newHref with entityName::"+newHref+ "?" + entityName);
-
//parent.parent.location.assign(newHref+ "?" + entityName);
-
//location.href = newHref+ "?" + entityName;
-
window.top.location.href = newHref+ "?" + entityName;
-
alert("Before return::"+window.top.location.href);
-
return newHref+ "?" + entityName;
-
-
}
-
-
function displayRelationships(entityName){
-
var loc = decodeURI(location + "");
-
if (loc.substr(0, 8) == "file:///") {
-
loc = loc.substr(8);
-
loc = loc.substr(0, loc.lastIndexOf("/")+1);
-
loc = top.GetAbsolutePathName(loc + "EntityRelationships.html");
-
if (!top.FileExists(loc)) return; // rather than risk IE crashing in XP SP2
-
}
-
alert("DRParent::"+loc + "?" + entityName);
-
//window.location.href = loc + "?" + entityName;
-
//parent.parent.location.href = loc + "?" + entityName;
-
}
-
-
function createRelationships()
-
{
-
-
if (!checkViewerVersion(true)) {
-
return;
-
}
-
-
if (entity == null) {
-
return;
-
}
-
-
var numRelationships = relationships.length;
-
-
var mainEntityText = svgDocument.getElementById("maintext");
-
var mainEntityBox = svgDocument.getElementById("mainbox");
-
-
var entityName = entity.getAttribute("name");
-
-
mainEntityBox.setAttribute("fill",entity.getAttribute("color"));
-
-
//position the main box so that its center is level with the middle of the related entities
-
//- don't forget to ignore the gap after the last related entity!
-
-
var mainEntityHeight = Number(mainEntityBox.getAttribute("height"));
-
-
var mainEntityTop = ((RELATED_ENTITY_SPACING * numRelationships) - RELATED_ENTITY_GAP - mainEntityHeight) / 2;
-
mainEntityBox.setAttribute("y", mainEntityTop);
-
mainEntityBox.setAttribute("onclick", "displayDescription('" + entityName + "');");
-
-
-
mainEntityText.firstChild.nodeValue = entityName;
-
mainEntityText.setAttribute("y",mainEntityTop + (mainEntityHeight + FONT_SIZE) / 2 );
-
mainEntityText.setAttribute("font-size", FONT_SIZE);
-
-
-
-
var mainEntityCenterX = Number(mainEntityBox.getAttribute("x")) + (Number(mainEntityBox.getAttribute("width"))/2);
-
var mainEntityCenterY = Number(mainEntityBox.getAttribute("y")) + (Number(mainEntityHeight)/2);
-
-
var mainEntityRightEdge = Number(mainEntityBox.getAttribute("x")) + Number(mainEntityBox.getAttribute("width"));
-
-
-
var contents = svgDocument.getElementById("contents");
-
-
maxX = mainEntityRightEdge;
-
maxY = Number(mainEntityBox.getAttribute("y")) + Number(mainEntityBox.getAttribute("height"));
-
-
var minLineTouchY = mainEntityTop;
-
var maxLineTouchY = mainEntityTop + mainEntityHeight;
-
-
var i;
-
for(i = 0; i < numRelationships; i++){
-
var relationship = relationships[i];
-
-
var g=svgDocument.createElement("g");
-
contents.appendChild(g);
-
-
var x = RELATED_ENTITY_X;
-
var y = RELATED_ENTITY_SPACING * i;
-
-
//create the line
-
-
var line=svgDocument.createElement("line");
-
g.appendChild(line);
-
-
//we draw the line towards the center of the main entity
-
-
//identify the point where this line crosses the main entity's right edge
-
-
var lineRelatedEntityY = y + RELATED_ENTITY_HEIGHT / 2;
-
var lineMainEntityY = mainEntityCenterY + (lineRelatedEntityY - mainEntityCenterY) * (mainEntityRightEdge - mainEntityCenterX) / (x - mainEntityCenterX);
-
-
if (lineMainEntityY < minLineTouchY) {minLineTouchY = lineMainEntityY;}
-
if (lineMainEntityY > maxLineTouchY) {maxLineTouchY = lineMainEntityY;}
-
-
line.setAttribute("x1",x);
-
line.setAttribute("y1",lineRelatedEntityY);
-
-
line.setAttribute("x2",mainEntityRightEdge);
-
line.setAttribute("y2",lineMainEntityY);
-
-
//draw cardinalities at the main entity end
-
drawCardinalities (g, x, lineRelatedEntityY, mainEntityRightEdge, lineMainEntityY, relationship.getAttribute("this.cardinality"));
-
-
//draw cardinalities at the related entity end
-
drawCardinalities (g, mainEntityRightEdge, lineMainEntityY, x, lineRelatedEntityY, relationship.getAttribute("related.cardinality"));
-
-
var relatedEntityName = relationship.getAttribute("related.name");
-
-
-
//create a hyperlink (don't specify the target; just used to cause the mouse pointer to change)
-
var a=svgDocument.createElement("a");
-
-
g.appendChild(a);
-
-
var rect=svgDocument.createElement("rect");
-
a.appendChild(rect);
-
-
rect.setAttribute("x",x);
-
rect.setAttribute("y",y);
-
rect.setAttribute("height",RELATED_ENTITY_HEIGHT);
-
rect.setAttribute("width",RELATED_ENTITY_WIDTH );
-
rect.setAttribute("class","box");
-
-
rect.setAttribute("fill",relationship.getAttribute("related.color"));
-
-
rect.setAttribute("onclick","displayRelationships('" + relatedEntityName + "')");
-
-
var rectMaxX = Number(rect.getAttribute("x")) + Number(rect.getAttribute("width"));
-
var rectMaxY = Number(rect.getAttribute("y")) + Number(rect.getAttribute("height"));
-
-
if (rectMaxX > maxX) {maxX = rectMaxX;}
-
if (rectMaxY > maxY) {maxY = rectMaxY;}
-
-
var text=svgDocument.createElement("text");
-
a.appendChild(text);
-
-
text.setAttribute("x",x + RELATED_ENTITY_WIDTH / 2);
-
-
text.setAttribute("y",y + (RELATED_ENTITY_HEIGHT + FONT_SIZE) /2);
-
text.setAttribute("text-anchor","middle");
-
text.setAttribute("font-size", FONT_SIZE);
-
-
var textValue = svgDocument.createTextNode(relatedEntityName);
-
text.appendChild(textValue);
-
-
-
}
-
-
//size the main entity to ensure that all lines touch
-
mainEntityBox.setAttribute("y", minLineTouchY);
-
mainEntityBox.setAttribute("height", maxLineTouchY - minLineTouchY);
-
-
minY = 0;
-
if (numRelationships == 0) {minY = minLineTouchY;}
-
if (maxLineTouchY > maxY) {maxY = maxLineTouchY;}
-
-
//finally set the initial zoom so that the whole document is displayed
-
-
var svg = svgDocument.getElementById("svg");
-
svg.setAttribute("viewBox",
-
(0 - STROKE_WIDTH_COMPENSATION) + " " +
-
(minY - STROKE_WIDTH_COMPENSATION) + " " +
-
(maxX + 2 * STROKE_WIDTH_COMPENSATION) + " " +
-
(maxY - minY + 2 * STROKE_WIDTH_COMPENSATION)
-
);
-
-
}
-
-
The st does not allow for submitting long messages so I needed to split the code into parts. There is a next one. -
-
function drawCardinalities(g, x1, y1, x2, y2, cardinalityDesc) {
-
-
-
var optional;
-
var many;
-
-
if (cardinalityDesc == "0..1") {
-
optional = true;
-
many = false;
-
} else if (cardinalityDesc == "1..1") {
-
optional = false;
-
many = false;
-
} else if (cardinalityDesc == "0..*") {
-
optional = true;
-
many = true;
-
} else if (cardinalityDesc == "1..*") {
-
optional = false;
-
many = true;
-
} else {
-
//not recognized
-
return;
-
}
-
-
-
//work out the point to draw lines near the entity
-
var optx = (OPTIONALITY_POINT * x1) + ((1 - OPTIONALITY_POINT) * x2 );
-
var opty = (OPTIONALITY_POINT * y1) + ((1 - OPTIONALITY_POINT) * y2 );
-
-
-
-
if (optional) {
-
//draw a circle
-
-
var circle=svgDocument.createElement("circle");
-
g.appendChild(circle);
-
-
circle.setAttribute("cx",optx);
-
circle.setAttribute("cy",opty);
-
circle.setAttribute("r",CIRCLE_RADIUS);
-
-
circle.setAttribute("fill","white");
-
circle.setAttribute("stroke","black");
-
circle.setAttribute("stroke-width",3);
-
} else {
-
-
//work out length of the main line using Pythagorus
-
-
var mainline_length = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
-
-
//draw a bar perpendicular to the line
-
-
var BAR_LENGTH = 5;
-
var barx1 = optx + BAR_LENGTH * (y2 - y1) / mainline_length;
-
var barx2 = optx - BAR_LENGTH * (y2 - y1) / mainline_length;
-
var bary1 = opty - BAR_LENGTH * (x2 - x1) / mainline_length;
-
var bary2 = opty + BAR_LENGTH * (x2 - x1) / mainline_length;
-
-
-
var line=svgDocument.createElement("line");
-
g.appendChild(line);
-
-
-
line.setAttribute("x1",barx1);
-
line.setAttribute("x2",barx2);
-
line.setAttribute("y1",bary1);
-
line.setAttribute("y2",bary2);
-
}
-
-
if (many) {
-
//draw a crow's foot
-
-
//work out the point to draw lines near the entity
-
var multix = (MULTIPLICITY_POINT * x1) + ((1 - MULTIPLICITY_POINT) * x2 );
-
var multiy = (MULTIPLICITY_POINT * y1) + ((1 - MULTIPLICITY_POINT) * y2 );
-
-
var polyline=svgDocument.createElement("polyline");
-
g.appendChild(polyline);
-
-
var points = "";
-
points += String(x2) + ", " + String(y2 + CROWS_FOOT_OFFSET) + " ";
-
points += String(multix) + ", " + String(multiy) + " ";
-
points += String(x2) + ", " + String(y2 - CROWS_FOOT_OFFSET) + " ";
-
-
polyline.setAttribute("points",points);
-
polyline.setAttribute("stroke","black");
-
polyline.setAttribute("stroke-width",2);
-
polyline.setAttribute("fill","none");
-
-
}
-
-
}
-
]]>
-
-
function checkViewerVersion(displayMessage) {
-
-
var WRONG_ASV_VERSION = 'Please ensure you are using version 3.0 of the Adobe'
-
+ ' SVG viewer. This viewer is available for download'
-
+ ' from http://www.adobe.com/svg.';
-
-
if (!window || !window.navigator || !window.navigator.appVersion
-
|| window.navigator.appVersion.indexOf("3.0") == -1) {
-
if (displayMessage) {
-
alert(WRONG_ASV_VERSION);
-
}
-
return false;
-
} else {
-
return true;
-
}
-
}
-
</script>
-
-
<g id ="all">
-
<!-- backdrop so events are picked up at every pixel -->
-
<rect id = "backdrop" fill="white" width="700"/>
-
<g id="contents" onload="createRelationships()">
-
<a>
-
<rect id="mainbox" x="0" y="100" height="300" width="200" class="box"/>
-
<text id="maintext" x="100" y="100" text-anchor="middle"> </text>
-
</a>
-
</g>
-
</g>
-
</svg>
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Scott |
last post by:
I'm new to ASP, but I've been programming in VB for
several years, and I'm having a few issues with this ASP
enhancement I'm working on. I've found ASP to be a lot
different than what I'm use to...
|
by: venkatesh |
last post by:
Hi Members,
I have used the below mentioned code to open a html page in a new
browser. The window size is 200 x 300. In that browser, I've given
code to open another browser of the same size....
|
by: Tersia Ehlert |
last post by:
Hi
I have an .NET web application where I redirect a page on submit to a blank page where the code below runs client side.
I want to, with this code, refresh two frames - the one my page was...
|
by: spam_me_ not |
last post by:
I already understand that one cannot disable a browser's
forward and back functions. This is a situation where I
have code working in Mozilla V1.6 and would like something
similar for Opera and...
|
by: voodoolv |
last post by:
So..
I have a javascript that makes a popup with a javscript function in it.
The function in the popup after 5 seconds tries to change the "price" field value in the opener window:
sourze=...
|
by: Dennis Ålund |
last post by:
Is it possible to notice a change of window.location.hash without
polling?
I'm working on a Ajax-platform (yes, inventing the wheel again) and
have finished almost everything except the support...
|
by: johnsonholding |
last post by:
Here is the code for a pop-up window that works in Firefox and not in
IE - I get a java error or something,
Here is the code :
</script>
<SCRIPT language="JavaScript"...
|
by: tshad |
last post by:
This was posted before but the message got messed up (all NLs were stripped
out for some reason).
I have 2 labels that hold the name of different images on my .aspx page.
<asp:Label ID="Logo"...
|
by: mikewagan |
last post by:
hello guys, Javascript's been bugging on IE, and i'm trying to search for a solution for this answer but no luck.
I have a select box as a navigation element. If a user clicks on an option, it...
|
by: vinpkl |
last post by:
hi all
i have two dynamic drop downs of dealer id and category id which work properly with window.location
var dealerid;
function getList(xyz)
{...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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,...
|
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: 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...
| |