`
mdyanswer
  • 浏览: 15200 次
  • 性别: Icon_minigender_1
  • 来自: 广州
文章分类
社区版块
存档分类

中文作为参数传入 window.showModalDialog出现乱码的解决方法

阅读更多

今天碰到一个问题:
    输入一个商品关键字,按回车,然后弹出一个窗口列出包含这个关键字的商品,在传入这个关键字是出现了乱码。

问题的解决方法很简单,就是将url转码

     var url = ctx+"/good!list.do?todo=show&good.name="+name;
	        url = encodeURI(encodeURI(url));//中文转码
          window.showModalDialog(url, '',  "status:no;left:yes;scroll:yes;resizable:no;help:no;
           dialogWidth:800px;dialogHeight:600px");

 

 

1
0
分享到:
评论
2 楼 mdyanswer 2011-12-23  
json20080301 写道
直接用JS 对象传过去,不在URL中写中文

json传过去还要在页面获取一次,而这样只需要加一句代码就行了
url = encodeURI(encodeURI(url));
1 楼 json20080301 2011-12-23  
直接用JS 对象传过去,不在URL中写中文

相关推荐

    google不支持window.showModalDialog问题解决方案

    This is a `window.showModalDialog()` shim using a modal HTML5 `<dialog>` element and ECMAScript 6 Generators. It was tested in the latest Google Chrome with the *Enable Experimental JavaScript* flag ...

    window.showModalDialog模式对话框和 window.open的区别

    `window.showModalDialog` 和 `window.open` 都是JavaScript提供的两种打开新窗口的方法,但它们在功能和使用场景上有着显著的区别。 首先,我们来详细探讨`window.showModalDialog`。`showModalDialog`方法用于...

    window.showModalDialog以及window.open用法简介

    Window.showModalDialog 和 Window.open 都是 JavaScript 中的方法,用于创建新窗口或对话框,下面分别介绍它们的用法和参数。 一、Window.open() 方法 Window.open() 方法用于打开一个新的浏览器窗口,可以指定新...

    Window.ShowModalDialog使用手册

    在JavaScript编程语言中,`Window.showModalDialog()`方法是一个非常重要的功能,主要用于打开一个模态对话框,即用户必须关闭对话框才能与父窗口进行交互。这个方法在创建用户交互和自定义弹出窗口场景中非常有用。...

    解决window.showModalDialog跨域返回值

    在JavaScript中,`window.showModalDialog`是一个古老但仍然有用的函数,用于打开一个模态对话框,用户在对话框中进行交互,直到关闭对话框为止。然而,当涉及到跨域时,`showModalDialog`面临一个问题:它无法正确...

    针对window.showmodaldialog弹出窗体无刷新的详细使用

    本文将详细介绍`window.showModalDialog`的使用方法及其相关知识点。 1. **基本语法** `window.showModalDialog` 的基本调用形式如下: ```javascript var returnValue = window.showModalDialog(url, window, ...

    JS 弹出对话框window.showModalDialog()

    如果新窗口被关闭且 `window.returnValue` 被设置,则会将该值作为 `showModalDialog` 函数的返回值。 以下示例展示了如何在新窗口中设置 `window.returnValue` 并在原始窗口中接收返回值: ```javascript // 在...

    window.showModalDialog方法的使用

    在JavaScript编程中,`window.showModalDialog`是一个用于打开模态对话框的函数,它能够创建一个新的浏览器窗口或者在当前窗口内显示一个弹出层,阻止用户与父窗口的交互,直到用户关闭对话框为止。这个方法在创建...

    window.showModalDialog(javascript)

    【window.showModalDialog() 方法详解】 在Web开发中,JavaScript提供了两种对话框方式来与用户交互,即模态对话框和非模态对话框。本文将重点介绍模态对话框的使用方法`window.showModalDialog()`。 模态对话框是...

    window.showModalDialog的基本用法

    ### window.showModalDialog 的基本用法 `window.showModalDialog` 是一个早期的浏览器功能,主要在 Internet Explorer(IE)4.0 及以上版本中支持。它用于打开一个新的模态对话框窗口,并且该窗口将阻止用户与主...

    父子窗口传值window.showModalDialog以及window.open用法简介

    window.showModalDialog以及window.open用法简介

    window.showModalDialog打开跨域的页面并取到返回值

    主页面用window.showModalDialog的时候,如果直接打开其它系统的页面,这时候别人的页面在window.returnValue=1;这样返回值的时候,主页面是取不到返回值的,原因就是因为跨域了.

    关于struts2里用javascript刷新window.showModalDialog的父页面

    其中一个常见的场景就是通过`window.showModalDialog`方法打开一个新窗口,并在完成某些操作后刷新父页面。本文将详细介绍如何在Struts2项目中实现这一功能。 #### Struts2简介 Struts2是基于MVC设计模式的一个...

    ShowModalDialog与window.open的区别

    JavaScript 提供了两种常用的方法来创建这类窗口:`ShowModalDialog` 和 `window.open`。这两种方法各有特点,在不同的场景下具有不同的适用性。 #### 二、ShowModalDialog详解 **1. 功能介绍** `ShowModalDialog...

    window.showModalDialog的一个domo模型

    `window.showModalDialog` 是一个在JavaScript中用于打开模态对话框的函数,它在Web开发中被广泛使用,特别是在创建自定义对话框时。在这个示例中,我们有一个名为"TestWindowDialog"的压缩包文件,其中包含了实现`...

    'window.ShowModalDialog'在Chrome中不起作用

    描述中提到的解决方案是使用 `window.open()` 方法来替代 `showModalDialog()`. `window.open()` 可以创建一个新的浏览器窗口或者打开一个已经存在的窗口,并且可以设置新窗口的各种属性,如位置、大小、是否显示...

    window.showModalDialog('d.html',fault,'');

    总结来说,`window.showModalDialog` 是一个过时的 JavaScript 功能,用于弹出模态对话框,但现代 Web 开发已倾向于使用更灵活和兼容的解决方案。了解这一历史遗留功能有助于理解早期网页交互的设计思路,同时也提醒...

Global site tag (gtag.js) - Google Analytics