该行var ndx = url.indexOf( parameter );
导致代码返回而不显示以下任一警报.显示网址的提示是正确的.
function setFrameSrc() {
var url = document.location;
if (null == url) {
alert('Javascript Error: Null Object - document.location');
return;
}
alert('URL = ' + url);
var parameter = '?image=';
var ndx = url.indexOf(parameter);
if (ndx < 0) {
alert('Parameter not found = ' + parameter);
return;
}
alert('Index of ' + parameter + ' = ' + ndx);
var frame = document.getElementById('pframe');
if (null == frame) {
alert('Javascript Error: Null Object - …
Run Code Online (Sandbox Code Playgroud)